const socketIo = require('socket.io')

module.exports = server => {
  const io = socketIo.listen(server)
  console.log('Listening socket...')

  io.on('connection', socket => {
    // register publish side
    socket.on('register-publisher', () => {
      socket.emit('event', { code: 1, msg: 'Publisher register success!' })
    })

    // publish car info
    socket.on('publish-car-info', data => {
      console.log(data)
    })
  })
}
